import React, { Component, useEffect, useState, useRef } from 'react';
import { Table } from 'antd';
import { connect } from 'dva';
import TableList from '@/components/TableList';

@connect(({ base }: any) => ({ base }))
class Department extends Component {
  table = null;
  columns = [
    { title: '评审专家', dataIndex: 'title' },
    { title: '评审次数', dataIndex: 'totalCount' },
    { title: '评审项目数', dataIndex: 'examineCount' },
    { title: '评审金额（万元）', dataIndex: 'examineAmount' },
    { title: '审减金额（万元）', dataIndex: 'examineReduceAmount' },
    { title: '审加金额（万元）', dataIndex: 'examineAddAmount' },
  ];
  componentWillReceiveProps(nextProps) {
    const { type } = nextProps;
    if (type == 3) {
      this.table && this.table.fetch();
    }
  }
  render() {
    return (
      <TableList
        columns={this.columns}
        onRef={c => {
          this.table = c;
        }}
        bordered
        post
        source="/api/analysis/v1/examineAnalysis/person"
      />
    );
  }
}

export default Department;
